import { createRouter, createWebHashHistory  } from 'vue-router'
import HomeView from '../views/HomeView.vue'

// 菜单
export const sideMenus = [
  { name: 'admin-home', id: 0, title: '首页', children: [] },
  { 
    name: 'article', id:100, title:'文章管理', children: [
      { name: 'article-test', id: 101, title: '文章测试' },
      { name: 'article-curd', id: 102, title: 'curd' },
      { name: 'article-tscurd', id: 103, title: 'ts-curd' },
      { name: 'category', id: 104, title: '文章分类' },
    ]
  },
  { 
    name: 'vue', id:800, title:'vue官网实例', children: [
      { name: 'markdown', id: 801, title: 'Markdown编辑器' },
    ]
  },
  {
    name: 'css', id: 700, title: 'CSS学习', children: [
      { name: 'css-flex', id: 701, title: 'flex布局' },
      { name: 'css-grid', id: 702, title: 'grid布局' },
      { name: 'css-less', id: 703, title: 'less' },
      { name: 'css-sass', id: 704, title: 'sass' },

    ]
  },
  {
    name: 'system', id: 900, title: '系统设置', children: [
      { name: 'user', id: 998, title: '用户管理' }
    ]
  }
]
// 路由配置
let routes = [
  {
    path: '/',
    redirect: '/admin-home'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [
      // 主页面
      {
        path: "/admin-home",
        name: 'admin-home',
        component: () => import("@/components/home/AdminHome.vue"),
        meta: { title: "首页" },
      },
      {
        path: "/article-test",
        name: 'article-test',
        component: () => import("@/components/article/ArticleTest.vue"),
      },
      {
        path: "/article-curd",
        name: 'article-curd',
        component: () => import("@/components/article/ArticleCurd.vue"),
      },
      {
        path: "/article-tscurd",
        name: 'article-tscurd',
        component: () => import("@/components/article/ArticleTsCurd.vue"),
      },
      {
        path: "/category",
        name: 'category',
        component: () => import("@/components/article/ArticleCategory.vue"),
      },
      {
        path: "/css-flex",
        name: 'css-flex',
        component: () => import("@/components/learning/CSSFlex.vue"),
      },
      {
        path: "/css-grid",
        name: 'css-grid',
        component: () => import("@/components/learning/CSSGrid.vue"),

      },
      {
        path: "/css-less",
        name: 'css-less',
        component: () => import("@/components/learning/CSSLess.vue"),

      },
      {
        path: "/css-sass",
        name: 'css-sass',
        component: () => import("@/components/learning/CSSSass.vue"),
        meta: { title: "CSS学习" },
      },  
      // vue官网实例 - markdown编辑器 
      {
        path: "/markdown",
        name: 'markdown',
        component: () => import("@/components/vue/Markdown.vue"),
        meta: { title: "Markdown编辑器" },
      },
      // 系统设置 - 用户管理
      {
        path: "/user",
        name: 'user',
        component: () => import("@/components/system/UserManage.vue"),
        meta: { title: "用户管理" },
      }
    ],
  },
  {
    path: "/login",
    component: () => import("@/views/LoginView.vue"),
  },
  {
    path: "/dataV",
    component: () => import("@/views/DataVView.vue"),
  },
  {
    path: "/home1",
    component: () => import("@/views/Home1View.vue"),
  }
]


const router = createRouter({
  history: createWebHashHistory (import.meta.env.BASE_URL),
  routes:routes
})

export default router
